import React from 'react'
import { useNavigate } from 'react-router-dom'
import { Button, Toast, Switch } from 'antd-mobile'
import { LeftOutline, RightOutline, } from 'antd-mobile-icons'
import './set.scss'
import { useDispatch ,useSelector} from 'react-redux'
import { CLEAR_USER } from '../../../store/actionType'
import { SET_CHANGE_SET } from '../../../store/actionType'

export default function Set() {
  const navigate = useNavigate()
  const dispatch = useDispatch()
  const {tabReducer} = useSelector((state:any)=> state)
  return (
    <div>
      <div className='set_back'>
        <Button onClick={() => navigate(-1)}><LeftOutline /></Button>
        设置
      </div>
      <div className='set_main'>
        <ul>
          <li><span>《用户协议》</span> <i><RightOutline /></i></li>
          <li><span>用户隐私协议</span><i><RightOutline /></i></li>
          <li><span>当前版本</span> <span></span><i>3.6.2</i></li>
          <li><span>版本更新</span><i>当前已是最新版本</i></li>
          <li><span>更多推荐</span><i><Switch
            style={{
              '--checked-color': '#754428',
              '--height': '26px',
              '--width': '45px',
            }}
            checked={tabReducer.changeSet}
            onChange={(val)=>{
              dispatch({type:SET_CHANGE_SET,payload:val})
            }}
          /></i></li>
          <li><span>关于我们</span><i><RightOutline /></i></li>
        </ul>
      </div>
    </div>
  )
}
